// Copyright (c) 2020-present,  INSPUR Co, Ltd.  All rights reserved.
#ifndef KWDBTS_CLIENT_INCLUDE_PG_DATA_TYPE_H_
#define KWDBTS_CLIENT_INCLUDE_PG_DATA_TYPE_H_

#include <string>
#include <unordered_map>

namespace kwdbts {

  enum PgDataType {
  T_BOOL = 16,
  T_BYTEA = 17,
  T_CHAR = 18,
  T_NAME = 19,
  T_INT8 = 20,
  T_INT2 = 21,
  T_INT2VECTOR = 22,
  T_INT4 = 23,
  T_REGPROC = 24,
  T_TEXT = 25,
  T_OID = 26,
  T_TID = 27,
  T_XID = 28,
  T_CID = 29,
  T_OIDVECTOR = 30,
  T_PG_DDL_COMMAND = 32,
  T_PG_TYPE = 71,
  T_PG_ATTRIBUTE = 75,
  T_PG_PROC = 81,
  T_PG_CLASS = 83,
  T_JSON = 114,
  T_XML = 142,
  T__XML = 143,
  T_PG_NODE_TREE = 194,
  T__JSON = 199,
  T_SMGR = 210,
  T_INDEX_AM_HANDLER = 325,
  T_POINT = 600,
  T_LSEG = 601,
  T_PATH = 602,
  T_BOX = 603,
  T_POLYGON = 604,
  T_LINE = 628,
  T__LINE = 629,
  T_CIDR = 650,
  T__CIDR = 651,
  T_FLOAT4 = 700,
  T_FLOAT8 = 701,
  T_ABSTIME = 702,
  T_RELTIME = 703,
  T_TINTERVAL = 704,
  T_UNKNOWN = 705,
  T_CIRCLE = 718,
  T__CIRCLE = 719,
  T_MONEY = 790,
  T__MONEY = 791,
  T_MACADDR = 829,
  T_INET = 869,
  T__BOOL = 1000,
  T__BYTEA = 1001,
  T__CHAR = 1002,
  T__NAME = 1003,
  T__INT2 = 1005,
  T__INT2VECTOR = 1006,
  T__INT4 = 1007,
  T__REGPROC = 1008,
  T__TEXT = 1009,
  T__TID = 1010,
  T__XID = 1011,
  T__CID = 1012,
  T__OIDVECTOR = 1013,
  T__BPCHAR = 1014,
  T__VARCHAR = 1015,
  T__INT8 = 1016,
  T__POINT = 1017,
  T__LSEG = 1018,
  T__PATH = 1019,
  T__BOX = 1020,
  T__FLOAT4 = 1021,
  T__FLOAT8 = 1022,
  T__ABSTIME = 1023,
  T__RELTIME = 1024,
  T__TINTERVAL = 1025,
  T__POLYGON = 1027,
  T__OID = 1028,
  T_ACLITEM = 1033,
  T__ACLITEM = 1034,
  T__MACADDR = 1040,
  T__INET = 1041,
  T_BPCHAR = 1042,
  T_VARCHAR = 1043,
  T_DATE = 1082,
  T_TIME = 1083,
  T_TIMESTAMP = 1114,
  T__TIMESTAMP = 1115,
  T__DATE = 1182,
  T__TIME = 1183,
  T_TIMESTAMPTZ = 1184,
  T__TIMESTAMPTZ = 1185,
  T_INTERVAL = 1186,
  T__INTERVAL = 1187,
  T__NUMERIC = 1231,
  T_PG_DATABASE = 1248,
  T__CSTRING = 1263,
  T_TIMETZ = 1266,
  T__TIMETZ = 1270,
  T_BIT = 1560,
  T__BIT = 1561,
  T_VARBIT = 1562,
  T__VARBIT = 1563,
  T_NUMERIC = 1700,
  T_REFCURSOR = 1790,
  T__REFCURSOR = 2201,
  T_REGPROCEDURE = 2202,
  T_REGOPER = 2203,
  T_REGOPERATOR = 2204,
  T_REGCLASS = 2205,
  T_REGTYPE = 2206,
  T__REGPROCEDURE = 2207,
  T__REGOPER = 2208,
  T__REGOPERATOR = 2209,
  T__REGCLASS = 2210,
  T__REGTYPE = 2211,
  T_RECORD = 2249,
  T_CSTRING = 2275,
  T_ANY = 2276,
  T_ANYARRAY = 2277,
  T_VOID = 2278,
  T_TRIGGER = 2279,
  T_LANGUAGE_HANDLER = 2280,
  T_INTERNAL = 2281,
  T_OPAQUE = 2282,
  T_ANYELEMENT = 2283,
  T__RECORD = 2287,
  T_ANYNONARRAY = 2776,
  T_PG_AUTHID = 2842,
  T_PG_AUTH_MEMBERS = 2843,
  T__TXID_SNAPSHOT = 2949,
  T_UUID = 2950,
  T__UUID = 2951,
  T_TXID_SNAPSHOT = 2970,
  T_FDW_HANDLER = 3115,
  T_PG_LSN = 3220,
  T__PG_LSN = 3221,
  T_TSM_HANDLER = 3310,
  T_ANYENUM = 3500,
  T_TSVECTOR = 3614,
  T_TSQUERY = 3615,
  T_GTSVECTOR = 3642,
  T__TSVECTOR = 3643,
  T__GTSVECTOR = 3644,
  T__TSQUERY = 3645,
  T_REGCONFIG = 3734,
  T__REGCONFIG = 3735,
  T_REGDICTIONARY = 3769,
  T__REGDICTIONARY = 3770,
  T_JSONB = 3802,
  T__JSONB = 3807,
  T_ANYRANGE = 3831,
  T_EVENT_TRIGGER = 3838,
  T_INT4RANGE = 3904,
  T__INT4RANGE = 3905,
  T_NUMRANGE = 3906,
  T__NUMRANGE = 3907,
  T_TSRANGE = 3908,
  T__TSRANGE = 3909,
  T_TSTZRANGE = 3910,
  T__TSTZRANGE = 3911,
  T_DATERANGE = 3912,
  T__DATERANGE = 3913,
  T_INT8RANGE = 3926,
  T__INT8RANGE = 3927,
  T_PG_SHSECLABEL = 4066,
  T_REGNAMESPACE = 4089,
  T__REGNAMESPACE = 4090,
  T_REGROLE = 4096,
  T__REGROLE = 4097,
};

static std::unordered_map<PgDataType, std::string> PgTypeName {
  {T_BOOL, "BOOL"},
  {T_BYTEA, "BYTEA"},
  {T_CHAR, "CHAR"},
  {T_NAME, "NAME"},
  {T_INT8, "INT8"},
  {T_INT2, "INT2"},
  {T_INT2VECTOR, "INT2VECTOR"},
  {T_INT4, "INT4"},
  {T_REGPROC, "REGPROC"},
  {T_TEXT, "TEXT"},
  {T_OID, "OID"},
  {T_TID, "TID"},
  {T_XID, "XID"},
  {T_CID, "CID"},
  {T_OIDVECTOR, "OIDVECTOR"},
  {T_PG_DDL_COMMAND, "PG_DDL_COMMAND"},
  {T_PG_TYPE, "PG_TYPE"},
  {T_PG_ATTRIBUTE, "PG_ATTRIBUTE"},
  {T_PG_PROC, "PG_PROC"},
  {T_PG_CLASS, "PG_CLASS"},
  {T_JSON, "JSON"},
  {T_XML, "XML"},
  {T__XML, "_XML"},
  {T_PG_NODE_TREE, "PG_NODE_TREE"},
  {T__JSON, "_JSON"},
  {T_SMGR, "SMGR"},
  {T_INDEX_AM_HANDLER, "INDEX_AM_HANDLER"},
  {T_POINT, "POINT"},
  {T_LSEG, "LSEG"},
  {T_PATH, "PATH"},
  {T_BOX, "BOX"},
  {T_POLYGON, "POLYGON"},
  {T_LINE, "LINE"},
  {T__LINE, "_LINE"},
  {T_CIDR, "CIDR"},
  {T__CIDR, "_CIDR"},
  {T_FLOAT4, "FLOAT4"},
  {T_FLOAT8, "FLOAT8"},
  {T_ABSTIME, "ABSTIME"},
  {T_RELTIME, "RELTIME"},
  {T_TINTERVAL, "TINTERVAL"},
  {T_UNKNOWN, "UNKNOWN"},
  {T_CIRCLE, "CIRCLE"},
  {T__CIRCLE, "_CIRCLE"},
  {T_MONEY, "MONEY"},
  {T__MONEY, "_MONEY"},
  {T_MACADDR, "MACADDR"},
  {T_INET, "INET"},
  {T__BOOL, "_BOOL"},
  {T__BYTEA, "_BYTEA"},
  {T__CHAR, "_CHAR"},
  {T__NAME, "_NAME"},
  {T__INT2, "_INT2"},
  {T__INT2VECTOR, "_INT2VECTOR"},
  {T__INT4, "_INT4"},
  {T__REGPROC, "_REGPROC"},
  {T__TEXT, "_TEXT"},
  {T__TID, "_TID"},
  {T__XID, "_XID"},
  {T__CID, "_CID"},
  {T__OIDVECTOR, "_OIDVECTOR"},
  {T__BPCHAR, "_BPCHAR"},
  {T__VARCHAR, "_VARCHAR"},
  {T__INT8, "_INT8"},
  {T__POINT, "_POINT"},
  {T__LSEG, "_LSEG"},
  {T__PATH, "_PATH"},
  {T__BOX, "_BOX"},
  {T__FLOAT4, "_FLOAT4"},
  {T__FLOAT8, "_FLOAT8"},
  {T__ABSTIME, "_ABSTIME"},
  {T__RELTIME, "_RELTIME"},
  {T__TINTERVAL, "_TINTERVAL"},
  {T__POLYGON, "_POLYGON"},
  {T__OID, "_OID"},
  {T_ACLITEM, "ACLITEM"},
  {T__ACLITEM, "_ACLITEM"},
  {T__MACADDR, "_MACADDR"},
  {T__INET, "_INET"},
  {T_BPCHAR, "BPCHAR"},
  {T_VARCHAR, "VARCHAR"},
  {T_DATE, "DATE"},
  {T_TIME, "TIME"},
  {T_TIMESTAMP, "TIMESTAMP"},
  {T__TIMESTAMP, "_TIMESTAMP"},
  {T__DATE, "_DATE"},
  {T__TIME, "_TIME"},
  {T_TIMESTAMPTZ, "TIMESTAMPTZ"},
  {T__TIMESTAMPTZ, "_TIMESTAMPTZ"},
  {T_INTERVAL, "INTERVAL"},
  {T__INTERVAL, "_INTERVAL"},
  {T__NUMERIC, "_NUMERIC"},
  {T_PG_DATABASE, "PG_DATABASE"},
  {T__CSTRING, "_CSTRING"},
  {T_TIMETZ, "TIMETZ"},
  {T__TIMETZ, "_TIMETZ"},
  {T_BIT, "BIT"},
  {T__BIT, "_BIT"},
  {T_VARBIT, "VARBIT"},
  {T__VARBIT, "_VARBIT"},
  {T_NUMERIC, "NUMERIC"},
  {T_REFCURSOR, "REFCURSOR"},
  {T__REFCURSOR, "_REFCURSOR"},
  {T_REGPROCEDURE, "REGPROCEDURE"},
  {T_REGOPER, "REGOPER"},
  {T_REGOPERATOR, "REGOPERATOR"},
  {T_REGCLASS, "REGCLASS"},
  {T_REGTYPE, "REGTYPE"},
  {T__REGPROCEDURE, "_REGPROCEDURE"},
  {T__REGOPER, "_REGOPER"},
  {T__REGOPERATOR, "_REGOPERATOR"},
  {T__REGCLASS, "_REGCLASS"},
  {T__REGTYPE, "_REGTYPE"},
  {T_RECORD, "RECORD"},
  {T_CSTRING, "CSTRING"},
  {T_ANY, "ANY"},
  {T_ANYARRAY, "ANYARRAY"},
  {T_VOID, "VOID"},
  {T_TRIGGER, "TRIGGER"},
  {T_LANGUAGE_HANDLER, "LANGUAGE_HANDLER"},
  {T_INTERNAL, "INTERNAL"},
  {T_OPAQUE, "OPAQUE"},
  {T_ANYELEMENT, "ANYELEMENT"},
  {T__RECORD, "_RECORD"},
  {T_ANYNONARRAY, "ANYNONARRAY"},
  {T_PG_AUTHID, "PG_AUTHID"},
  {T_PG_AUTH_MEMBERS, "PG_AUTH_MEMBERS"},
  {T__TXID_SNAPSHOT, "_TXID_SNAPSHOT"},
  {T_UUID, "UUID"},
  {T__UUID, "_UUID"},
  {T_TXID_SNAPSHOT, "TXID_SNAPSHOT"},
  {T_FDW_HANDLER, "FDW_HANDLER"},
  {T_PG_LSN, "PG_LSN"},
  {T__PG_LSN, "_PG_LSN"},
  {T_TSM_HANDLER, "TSM_HANDLER"},
  {T_ANYENUM, "ANYENUM"},
  {T_TSVECTOR, "TSVECTOR"},
  {T_TSQUERY, "TSQUERY"},
  {T_GTSVECTOR, "GTSVECTOR"},
  {T__TSVECTOR, "_TSVECTOR"},
  {T__GTSVECTOR, "_GTSVECTOR"},
  {T__TSQUERY, "_TSQUERY"},
  {T_REGCONFIG, "REGCONFIG"},
  {T__REGCONFIG, "_REGCONFIG"},
  {T_REGDICTIONARY, "REGDICTIONARY"},
  {T__REGDICTIONARY, "_REGDICTIONARY"},
  {T_JSONB, "JSONB"},
  {T__JSONB, "_JSONB"},
  {T_ANYRANGE, "ANYRANGE"},
  {T_EVENT_TRIGGER, "EVENT_TRIGGER"},
  {T_INT4RANGE, "INT4RANGE"},
  {T__INT4RANGE, "_INT4RANGE"},
  {T_NUMRANGE, "NUMRANGE"},
  {T__NUMRANGE, "_NUMRANGE"},
  {T_TSRANGE, "TSRANGE"},
  {T__TSRANGE, "_TSRANGE"},
  {T_TSTZRANGE, "TSTZRANGE"},
  {T__TSTZRANGE, "_TSTZRANGE"},
  {T_DATERANGE, "DATERANGE"},
  {T__DATERANGE, "_DATERANGE"},
  {T_INT8RANGE, "INT8RANGE"},
  {T__INT8RANGE, "_INT8RANGE"},
  {T_PG_SHSECLABEL, "PG_SHSECLABEL"},
  {T_REGNAMESPACE, "REGNAMESPACE"},
  {T__REGNAMESPACE, "_REGNAMESPACE"},
  {T_REGROLE, "REGROLE"},
  {T__REGROLE, "_REGROLE"},
};

}  // namespace kwdbts

#endif  // KWDBTS_CLIENT_INCLUDE_PG_DATA_TYPE_H_
